package sharetime.playlist.domain;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import sharetime.user.domain.PermissionBase;
import sharetime.user.domain.Role;

@Entity
@DiscriminatorValue("playlist")
public class PlaylistPermission extends PermissionBase {

	private static final long serialVersionUID = -6871037825500293037L;

	private Playlist playlist;

	public PlaylistPermission() {
	}

	public PlaylistPermission(Playlist playlist, Role role) {
		super(role);
		this.playlist = playlist;
	}

	public PlaylistPermission(Playlist playlist, Role role, long allowMask,
			long denyMask) {
		super(role, allowMask, denyMask);
		this.playlist = playlist;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "fk_playlist_id")
	public Playlist getPlaylist() {
		return playlist;
	}

	public void setPlaylist(Playlist playlist) {
		this.playlist = playlist;
	}
}
